<%@page import="org.proddevplm.dao.data.stakeholders.Stakeholder"%>
<%@page import="java.util.List"%>

<script>
	dataType = "stakeholders"; //flag value for persisting importances in the right entity
	
	$(function(){
		$( "button" ).button();
	});

	$(document).ready(function() {
		var aux = document.getElementById('auxVal').value;	
		$("#noOfElements").val(aux);
	});
	
	function generateWspace(size){
		var elements = '';
		
		for (var i=0; i<size-1; i++){
			var id = 'Element_'+i;
			elements+=$('#'+id).html()+"~";
		}
		var lastIndex = size-1;
		var lastId = 'Element_'+lastIndex;
		elements+=$('#'+lastId).html();
		
		var arguments = "matrixSize="+size+"&elements="+elements;
		ajaxCall("dataAccessManager", "15", arguments, null);
		
		loadAHPWorkspace("content/project/devTools/workspace/prioritization/generateWorkspace.jsp")
		
	}

</script>

		
<%
	List shResults = (List)session.getAttribute("shResults");
	int matrixSize = shResults.size();
%>

<input type="hidden" id="auxVal" value="<%=shResults.size()%>">
<table align="center" border="1" cellspacing="0"; cellpadding="3" style="width:80%; font-size:small;">
	<%for(int i=0; i<shResults.size(); i++) {
		Stakeholder sh = (Stakeholder)shResults.get(i);
		%>
		<tr>
			<td style="width:15%; text-align:center;"><%=i+1%></td>
			<td id="Element_<%=i%>"><%=sh.getShName()%></td>
		</tr>
		
	<%} %>
</table>

<div id="showPrioritize">
	<button id="generateWspace" name="generateWspace" onclick="generateWspace('<%=matrixSize%>')" style="width:80%; margin-top:5px; font-weight: bold; font-size:smaller; float:center;">Generate workspace</button>
</div>